package com.easybuilder.weixin.controller;

import com.easybuilder.common.base.controller.BaseController;
import com.easybuilder.weixin.entity.WXUser;
import com.easybuilder.weixin.service.WxLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx")
public class WxLoginController extends BaseController {
    @Autowired
    private WxLoginService loginService;

    @GetMapping("/login/{code}")
    public Result<WXUser> login(@PathVariable(name = "code", required = true)String code) {
        return OK(loginService.login(code));
    }
}
